import request from '@/utils/request'

// 分类-获取-文章分类
export const artGetChannelsService = () => request.get('/my/cate/list')
// 分类-增加-文章分类
export const artAddChannelService = (data) => request.post('/my/cate/add', data)
// 分类-编辑-文章分类
export const artEditChannelService = (data) => {
  return request.put('/my/cate/info', data)
}
// 分类-删除-文章分类
export const artDeleteChannelService = (id) =>
  request.delete('/my/cate/del', {
    params: {
      id
    }
  })

// 文章-获取-文章列表
export const artGetListService = (params) =>
  request.get('/my/article/list', {
    params
  })
// 文章-发布文章
// 注意: data 需要时 一个 formData 格式的对象
export const artPublishService = (data) => request.post('/my/article/add', data)

// 文章 - 编辑文章
export const artEditService = (data) => request.put('my/article/info', data)

// 文章 - 获取文章详情 - 用于编辑时的回显
export const artGetDetailService = (id) =>
  request.get('/my/article/info', { params: { id } })

// 文章 - 删除文章
export const artDelService = (id) =>
  request.delete('my/article/info', { params: { id } })
